<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script>
	
	var type = "";

	function pwShow(data) {
		document.getElementById("password").style.display = "block";
		document.pwForm.password.value = "";
		type = data;
	}
	
	function pwCheck() {
		if (document.pwForm.password.value != "${boardDto.PASSWORD}") {
			alert("비밀번호가 틀렸습니다.");
			document.pwForm.password.focus();
			return;
		}
		
		if (type == "modify") {
			location.href='boardWrite.do?seq=${boardDto.SEQ}';	
		} else {
			location.href='boardUpdate.do?mode=del&seq=${boardDto.SEQ}';
		}
	}
</script>

<%@ include file = "/inc/header.jsp" %>

<table width="500" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<tr>
	<td width="150" bgcolor="#EFEFEF" align="center">제목</td>
	<td bgcolor="#FFFFFF">${boardDto.SEQ }</td>
</tr>
<tr>
	<td width="150" bgcolor="#EFEFEF" align="center">글쓴이</td>
	<td bgcolor="#FFFFFF">${boardDto.WRITER }</td>
</tr>
<tr>
	<td width="150" bgcolor="#EFEFEF" align="center">날짜</td>
	<td bgcolor="#FFFFFF">${boardDto.REGDATE }</td>
</tr>
<tr>
	<td width="150" bgcolor="#EFEFEF" align="center">조회수</td>
	<td bgcolor="#FFFFFF">${boardDto.HITCOUNT }</td>
</tr>
<tr>
	<td width="150" bgcolor="#EFEFEF" align="center">제목</td>
	<td bgcolor="#FFFFFF">${boardDto.TITLE }</td>
</tr>
<tr>
	<td colspan="2" bgcolor="#FFFFFF">${boardDto.CONTENT }</td>
</tr>
<tr>
	<td colspan="2" align="right" bgcolor="#FFFFFF">
		<input type="button" value="수정" onclick="pwShow('modify');">
		<input type="button" value="삭제" onclick="pwShow('delete');">
		<input type="button" value="목록" onclick="location.href='boardList.do';">
	</td>
</tr>
</table>

<form name="pwForm">
<table width="500" id="password" style="display:none;">
<tr>
	<td align="right">
		비밀번호 : <input type="password" name="password" id="password">
		<input type="button" value="확인" onclick="pwCheck();">
	</td>
<tr>
</table>
</form>
<%@ include file = "/inc/footer.jsp" %>
